fix: stop leaving .env.bak plaintext secrets on every deploy - #197
Merged
Conversation
sed -i ".bak" on BSD sed creates a backup file containing the full .env (including all secrets) on every single deploy, and nothing ever cleaned it up. Found repeatedly during the credential rotation following the sakura.ad.jp incident (chore/records/2026-08-25). Switching to an empty backup suffix (sed -i "") makes BSD sed edit in place without creating a backup file at all. Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
…stead Code review flagged that changing the backup suffix to "" (an empty double-quote pair sitting inside already deeply nested ssh/bash -c/sed quoting) is hard to verify by inspection and risky for future edits. Revert to the previously-proven ".bak" quoting structure (confirmed working via .env.bak actually being created on the server) and just delete the backup file explicitly afterward. Same end result (no leftover .env.bak), but the intent is now a plain rm -f instead of relying on BSD sed's empty-suffix semantics threaded through triple quoting. Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
…tViolationException RawPageFactory and PageFactory both used faker->url() without unique(), but raw_pages.url and pages.url both have DB-level unique constraints (raw_pages_url_unique, pages_url_unique). Tests that create multiple Page/RawPage records in one test (e.g. SearchActionTest) occasionally collide on the same faker-generated URL and fail with UniqueConstraintViolationException, unrelated to any application code. Unrelated to this PR's original change, but needed to get CI green here since it surfaced on this PR's run. Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
sed -i ".bak"がデプロイの度に平文シークレット入りの.env.bakを残していた(誰も削除しない)ことが判明sed -i ""(空のバックアップ拡張子)に変更し、バックアップファイル自体を作らないようにしたTest plan
.env.bakが作られないことを確認🤖 Generated with Claude Code